package com.week2.zuhe;

public class Book1 
{
	private String name;
	private Author[] author= new Author[2];
	private double price;
	private int qty;
	public Book1(String name, Author[] author, double price) 
	{
		this.name = name;
		this.author = author;
		this.price = price;
	}
	public Book1(String name, Author[] author, double price, int qty) 
	{
		this.name = name;
		this.author = author;
		this.price = price;
		this.qty = qty;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public int getQty() {
		return qty;
	}
	public void setQty(int qty) {
		this.qty = qty;
	}
	public String getName() {
		return name;
	}
	public Author[] getAuthor() {
		return author;
	}
	
	public String toString()
	{
		return "Book[name="+name+",authors={"+author[0].toString()+","+author[1].toString()
				+"},price="+price+",qty="+qty+"]";
	}
	
	public String getAuthorNames()
	{
		return author[0].getName()+","+author[1].getName();
	}

}
//为什么name和author没有对应的set方法？
//toString和getAuthorNames方法里，如果author这个数组为空，或者不足两个怎么办？
